<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
set_time_limit(0);
include_once("../../config.inc.php");

session_start();
$_LangPath = "supplement7star";
$strTemplatePath = __Admintemplate_Path."/Supplemen7Star/";
if($_data["op"] != "sendOdds" && $_data["op"] != "sendSuppleWagerList")include_once(__Language_Path."/selectlanguage_admin.php");
include_once(__Modules_Path."/LogRecord.lib.php");
include_once(__Modules_Path."/Gamble.lib.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");

$arrPower = CheckUsePower("supplement7star");
if($arrPower === false && $_data["op"] != "sendOdds" && $_data["op"] != "sendSuppleWagerList")ErrMsgOutputHTML("Error", "", 1);


if(empty($_SESSION["Admin_Info"] -> GameType))$_SESSION["Admin_Info"] -> GameType = $_KSysParam[GamblePreLine];
if($_data["ChangeGameType"] == "Yes"){
	$_SESSION["Admin_Info"] -> GameType = $_data["GameType"];
}
$_data["GameType"] = ($_data["isGetSuppleOdds"] == "Y")?1:$_SESSION["Admin_Info"] -> GameType;

$intLottoID = (int)$_data["LottoID"];
if(empty($intLottoID))$intLottoID = 4;	// 預設七星彩
$arrLotto = $_arrLotto[$intLottoID];
$intLType = (int)$arrLotto["LType"];

$data = $_data["data"];
switch($_data["op"]){
	case "Wager":		//補貨下注
		include_once(__Admin_Path."/logincheck.php");
		include_once(__Modules_Path."/Wager.lib.php");
		include_once(__Modules_Path."/WagerForm.lib.php");
		include_once(__Modules_Path."/joinnumber.lib.php");
		@include_once(__Common_Path."/betparam/BetParam_".$intLottoID.".inc.php");

		if($arrPower[1] != "all"){
			$arrGamble = getGambleDataByID($_data["GambleID"]);
			if($arrGamble === false){
				ErrMsgOutputHTML("Error", "", 1);
			}

			if($arrGamble["isEnd"] == 1){
				$GLOBALS["errormessage"] = $_strSupplement["GameEndStopSupplement"];
				ErrMsgOutputHTML("Error", "", 1);
			}
		}
		include_once("Wager.php");
		include_once("GetOdds.php");
		break;

	case "MultiWager":		//多號碼補貨下注
		include_once(__Admin_Path."/logincheck.php");
		include_once(__Modules_Path."/Wager.lib.php");
		include_once(__Modules_Path."/WagerForm.lib.php");
		include_once(__Modules_Path."/joinnumber.lib.php");
		@include_once(__Common_Path."/betparam/BetParam_".$intLottoID.".inc.php");

		if($arrPower[1] != "all"){
			$arrGamble = getGambleDataByID($_data["GambleID"]);
			if($arrGamble === false){
				ErrMsgOutputHTML("Error", "", 1);
			}

			if($arrGamble["isEnd"] == 1){
				$GLOBALS["errormessage"] = $_strSupplement["GameEndStopSupplement"];
				ErrMsgOutputHTML("Error", "", 1);
			}
		}
		include_once("MultiWager.php");
		include_once("GetOdds.php");
		break;

	case "sendSuppleWagerList":			//送出補貨清單
		include_once(__DBConnect_File);
		include_once("sendSuppleWagerList.php");
		break;

	case "sendOdds":			//送出賠率
		include_once(__DBConnect_File);
		include_once(__Modules_Path."/joinnumber.lib.php");
		include_once(__Common_Path."/gambletype/GambleType".$_data["GameType"]."_".$intLottoID.".inc.php");
		include_once("sendOdds.php");
		break;

	case "GetOdds":				//抓取賠率
		include_once(__Admin_Path."/logincheck.php");
		include_once(__Modules_Path."/joinnumber.lib.php");
		include_once(__Common_Path."/gambletype/GambleType".$_data["GameType"]."_".$intLottoID.".inc.php");
		include_once("GetOdds.php");
		break;

	/*case "GetTemplate":		//取得樣版
		include(__Common_Path."/betparam/AnimalsParams_".$intLottoID.".inc.php");
		include_once("GetTemplate.php");
		break;*/

	default:								//顯示操盤表
		include_once(__Admin_Path."/logincheck.php");
		include_once(__Modules_Path."/Lotto.lib.php");
		//@include_once(__Common_Path."/todaygame/Gamble".$intLottoID.".inc.php");
		@include_once(__Common_Path."/betparam/BetParam_".$intLottoID.".inc.php");
		//取得警示設定資料
		$OverBetSQL = "SELECT * FROM `bet_AlertOverBet` WHERE `bA_MemID` = '". $_SESSION["Admin_Info"]->ID ."'";
		$RS = PMA_mysql_query($OverBetSQL, $$_Conn);
		if ($RS) {
			$PsObj = PMA_mysql_fetch_object($RS);
		}

		include_once("List.php");
		break;
}
@mysql_close($$_Conn);
?>